package spring.cloud.tasks.tasks_manager.database.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import spring.cloud.tasks.tasks_manager.domain.TaskConfiguration;

import java.util.Date;

@Slf4j
@Setter
@Getter
public class TaskConfigurationDto extends TaskConfiguration {
    private static final long serialVersionUID = 1L;
    private String createBy;
    private Date createTime;
    private String lastUpdateBy;
    private Date lastUpdateTime;
    //
    private Long id;
    private String nameSpace;
    private String zkList;
    private Integer rownum;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }

        TaskConfigurationDto that = (TaskConfigurationDto) o;

        if (rownum != null ? !rownum.equals(that.rownum) : that.rownum != null) {
            return false;
        }
        if (id != null ? !id.equals(that.id) : that.id != null) {
            return false;
        }
        if (createBy != null ? !createBy.equals(that.createBy) : that.createBy != null) {
            return false;
        }
        if (lastUpdateBy != null ? !lastUpdateBy.equals(that.lastUpdateBy) : that.lastUpdateBy != null) {
            return false;
        }
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) {
            return false;
        }
        if (lastUpdateTime != null ? !lastUpdateTime.equals(that.lastUpdateTime) : that.lastUpdateTime != null) {
            return false;
        }
        if (nameSpace != null ? !nameSpace.equals(that.nameSpace) : that.nameSpace != null) {
            return false;
        }
        return zkList != null ? zkList.equals(that.zkList) : that.zkList == null;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (rownum != null ? rownum.hashCode() : 0);
        result = 31 * result + (id != null ? id.hashCode() : 0);
        result = 31 * result + (createBy != null ? createBy.hashCode() : 0);
        result = 31 * result + (lastUpdateBy != null ? lastUpdateBy.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (lastUpdateTime != null ? lastUpdateTime.hashCode() : 0);
        result = 31 * result + (nameSpace != null ? nameSpace.hashCode() : 0);
        result = 31 * result + (zkList != null ? zkList.hashCode() : 0);
        return result;
    }
}
